This variable will give us the current number of menu items on the stage. It will start out having a value of 1 and every time a new clip is duplicated (which happens in the next piece of script), it will increase by one. Once CurrentClip reaches 10, the script will shut off.
The script will use this variable CurrentClip to get all of its information for the duplicating menu items. The new name of the duplications will be CurrentClip+1, so should there be only one menu item on the screen, the name of the new duplicate would be 2. If there were two menu items on the screen, the duplicate would be named 3. CurrentClip will also specify which depth the newly duplicated menu item should occupy. So if there is one menu item on the screen the new duplicate will occupy the depth 2. If there are two menu items the new duplicate will occupy depth 3.
Now we have an auto-building menu, spawning itself from one movie clip and one script. At this point, all of the menu items will be duplicating into the same physical position on the screen and sitting directly on top of each other. WeΓÇÖll make a small alteration to the action on the first frame of the movie clip Menu Item to correct this overlap problem, so that the duplicated menu items will cascade.